package cn.good.yan.apis;

import cn.good.yan.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 演示：分布式事务
 * 调用 cxx - 进行扣减该产品的库存
 *
 * @author shengren.yan
 * @create 2024-04-13
 */
@FeignClient(value = "seata-cxx-service")
public interface CxxFeignApi {

    /**
     * 扣减库存
     * 根据产品id，扣减库存数量
     *
     * @param productId
     * @param count
     * @return {@link ResultData}
     */
    @PostMapping(value = "/cxx/decrease")
    ResultData decrease(@RequestParam("productId") Long productId,
                        @RequestParam("count") Integer count);

}
